package com.maixun.lib_business_home.home

import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import com.maixun.lib_business_home.R
import com.maixun.lib_business_home.entity.BannerBeen
import com.maixun.lib_comment.recyclerview.ViewHolderImpl
import com.youth.banner.adapter.BannerAdapter

/**
 * @author：Lmoumou
 * @date：2020/10/16
 */
class ImageBannerAdapter(context: Context, dataList: MutableList<BannerBeen>) :
    BannerAdapter<BannerBeen, ViewHolderImpl>(dataList) {

    private val mInflater by lazy { LayoutInflater.from(context) }

    override fun onCreateHolder(parent: ViewGroup?, viewType: Int): ViewHolderImpl {
        return ViewHolderImpl(mInflater.inflate(R.layout.home_item_banner, parent, false))
    }

    override fun onBindView(holder: ViewHolderImpl?, data: BannerBeen?, position: Int, size: Int) {
        if (holder == null || data == null) return
        holder.loadPicture(R.id.mImageView, data.imagePath)
    }
}